<?

function db_init($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME)
{
  global $dblinkrc;
  $db_link = @mysql_pconnect($DB_HOST, $DB_USER, $DB_PASS) or
    logError('The database connection to server '.$DB_USER.'@'.$DB_HOST.' could not be established (code: '.@mysql_error($db_link).')');
  
  @mysql_select_db($DB_NAME, $db_link) or
    logError('The database connection to database '.$DB_NAME.' on '.$DB_USER.'@'.$DB_HOST.' could not be established. (code: '.@mysql_error($db_link).')');
}

function db_tablename($raw)
{
  global $config;
  return($config['db']['prefix'].$raw);
}

function db_get($table, $matches = array())
{
  
}

global $dbcache, $dblinkrc, $config;
if (!isset($dbcache)) $dbcache = array();
if (!isset($dblinkrc)) db_init($config['db']['host'], $config['db']['user'], $config['db']['password'], $config['db']['database']);

?>